package com.ruoyi.quartz.task;

import com.ruoyi.system.domain.BKStudent;
import com.ruoyi.system.service.BKService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("bkTask")
public class BKTask {
    private static final Logger log = LoggerFactory.getLogger(BKTask.class);

    @Autowired
    private BKService bkService; // 已注入BKService，使用它完成同步

    public void syncData() {
        try {
            log.info("【1/3】开始同步学生数据：准备从数据源获取数据");
            
            // 直接调用BKService的syncAll()方法，无需手动操作mapper
            bkService.syncAll();
            
            log.info("【3/3】学生数据同步完成");
        } catch (Exception e) {
            log.error("同步失败", e);
        }
    }
}